package com.zg.ktcomwan.fragment

import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.zg.ktcomwan.R
import com.zg.ktcomwan.adapter.SquareAdapter
import com.zg.ktcomwan.base.BaseFragment
import com.zg.ktcomwan.vm.SquareViewModel
import kotlinx.android.synthetic.main.common_tbar.*
import kotlinx.android.synthetic.main.fragment_per_project.*
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

/***
 * @Author:      zxd
 * @CreateDate:  2021/7/6 15:35
 * @Description: 广场
 */
class SquareFragment/* : BaseFragment() {

    private val model: SquareViewModel by viewModels()

    override fun getLayoutId(): Int {
        return R.layout.fragment_square
    }

    override fun afterCreate() {

        rv.layoutManager = LinearLayoutManager(activity)
        val adapter = activity?.let { SquareAdapter(it) }
        rv.adapter = adapter

        lifecycleScope.launch {
            model.articleList.collectLatest {
                adapter!!.submitData(it)
            }
        }
    }
}*/